// ex07.c -- modification of Listing 12.13
// Listing 12.13
/* mamydice.h -- multiples dice rolls */
/* compile with diceroll.c  */
#include <stdio.h>
#include <stdlib.h> /* for library rand() */
#include <time.h>   /* for time() */

#include "diceroll.h" /* for roll_n_dice() */
/* and for roll_count */
int main(void) {
  int dice, roll;
  int sides;
  int status;
  int sets;

  srand((unsigned int)time(0)); /* randomize seed */

  printf("Enter the number of sets; enter q to stop: ");
  while (scanf("%d", &sets) == 1 && sets > 0) {
    printf("How many sides and how many dice? ");
    scanf("%d %d", &sides, &dice);
    printf("Here are %d sets of %d %d-sided throws.\n", sets, dice, sides);
    for (int i = 0; i < sets; ++i) {
      if ((i + 1) % 10) {
        printf("\t%d", roll_n_dice(dice, sides));
      } else {
        printf("\n\t%d", roll_n_dice(dice, sides));
      }
    }
    printf("\nHow many sets? Enter q to stop: ");
  }

  return 0;
}
